package com.example.backblog.controller.front.fileupload;

import com.example.backblog.annotation.UserIdParameter;
import com.example.backblog.service.fileupload.FileService;
import com.example.backblog.vo.ApiResult;
import org.apache.shiro.authz.annotation.RequiresRoles;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/file")
public class FileInfoController {
    @Autowired
    private FileService fileService;
    @GetMapping("/all")
//    @RequiresRoles("vip")
    public ApiResult all(@UserIdParameter Long userId, Long parentId){
        return  ApiResult.success(fileService.findAll(parentId,userId));
    }
    @GetMapping("/one")
//    @RequiresRoles("vip")
    public ApiResult oneFile(Long id) throws Exception {
        return ApiResult.success(fileService.findOne(id));
    }
}
